#! /usr/bin/python

class Product:

    """"
    p_id = int - product id in DB
    p_name = string - product name
    p_pict = string - link to picture
    p_desc = string - product description
    p_link = string - link to product
    p_cat_id = int - category id

    """
    def __init__(self, pname, ppict, pdesc, plink, pcid):
        self.p_name = pname
        self.p_pict = ppict
        self.p_desc = pdesc
        self.p_link = plink
        self.p_cat_id = pcid

    def printProduct(self, f_path=None):
        if f_path:
            fd = open(f_path, "a")
            fd.write("Printing product....\n")
            fd.write("Product Name = %s\n" %self.p_name)
            fd.write("Product Picture_Link = %s\n" %self.p_pict)
            fd.write("Product Description = %s\n" %self.p_desc)
            fd.write("Product Link = %s\n" %self.p_link)
            fd.write("Product Category Id = %s\n" %self.p_cat_id)
            fd.write( "-------------------------------------\n")
            fd.close()
        else:
            print "Printing product...."
            print "Product Name = %s" %self.p_name
            print "Product Picture_Link = %s" %self.p_pict
            print "Product Description = %s" %self.p_desc
            print "Product Link = %s" %self.p_link
            print "Product Category Id = %s" %self.p_cat_id
            print "-------------------------------------"

class GiftAttribute:

    def __init__(self, aatrid, agid, aval):
        """
        """
        self.attr_id = aatrid
        self.gift_id = agid
        self.value = aval

    def printAttribute(self, f_path=None):
        if f_path:
            fd = open(f_path, "a")
            fd.write("Printing product attribute....\n")
            fd.write("Attribute Value = %s\n" %self.value)
            fd.write("Attribute Gift_Id = %s\n" %self.gift_id)
            fd.write("Attribute Attr_id = %s\n" %self.attr_id)
            fd.write("-------------------------------------\n")
            fd.close()
        else:
            print "Printing product attribute...."
            print "Attribute Value = %s\n" %self.value
            print "Attribute Gift_Id = %s\n" %self.gift_id
            print "Attribute Attr_id = %s\n" %self.attr_id
            print "-------------------------------------"
